export default {
    namespaced: true,
    state: {
  
      /** 左侧工具栏 **/
      type: '',
      angle: 0,
      hasDrawCanvas: false,
      toolsIndex: 0,
      /** 绘制信息 **/
      lineColor: '#f00',
      fillStyle: 'rgba(255, 0, 0, 0.1)',
      lineWidth: 1,
      mouseFrom: {
        x: 0,
        y: 0
      },
      mouseTo: {
        x: 0,
        y: 0
      },
      tableInde:0,
      tableInfo:{},
      tableCoords:[[]]
    },
    mutations: {
      SET_LEFT_TOOLS (state, { key, index ,tableInfo}) {
        state.type = key;
        state.toolsIndex = index;
        if(key==='table'){
          state.tableInde = state.tableInde+1;
          state.tableInfo = tableInfo;
        }
      },
      SET_DRAW_TYPE (state, payload) {
        state.type = payload;
      },
      SET_ANGLE_TO (state, payload) {
        state.angle = payload;
      },
      SET_HAS_DRAW_CANVAS (state, payload) {
        state.hasDrawCanvas = payload;
      },
      SET_LINE_COLOR (state, payload) {
        state.lineColor = payload;
      },
      SET_LINE_WIDTH (state, payload) {
        state.lineWidth = payload;
      },
      SET_tABLE_COORDS(state, payload){
        state.tableCoords = payload;
      },
      SET_MOUSE_FROM (state, payload) {
        state.mouseFrom = payload;
      },
      SET_MOUSE_TO (state, payload) {
        state.mouseTo = payload;
      },
      CLEAR_TABLE_DATA (state) {
        state.type = '';
        state.tableInfo = {};
        state.tableCoords = [[]];
      },
    }
  };